﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common.dto;

namespace Common.Shared.resp
{
    public class Resp<T> where T: new()
    {

        public int Status { get; set; }

        public string Message { get; set; } 

        public T Data { get; set; }

        public static Resp<T> Success(T data)
        {
            return new Resp<T>(200,"成功",data);
        }

        public static Resp<T> Success()
        {
            return new Resp<T>(200, "成功", new T());
        }

        public Resp(int status, string message, T data)
        {
            Status = status;
            Message = message;
            Data = data;
        }

        public static Resp<T> Fail(string tips)
        {
            return new Resp<T>(400, tips, new T());
        }
        
        public static Resp<T> Fail(int status,string tips)
        {
            return new Resp<T>(status, tips, new T());
        }
    }
}
